package table.creators;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import controllers.AuthorHelper;
import models.Insurance;
import models.Vehicle;
import models.Driver;
import controllers.Helper;
import controllers.TableModel;
import controllers.TableModel.AoColum;

public class InsuranceTable {

    public static TableModel create(String current_user) {
        final String INSURANCE1 = "|交强险|三者险|乘客险|意外险|车身险|盗抢险|玻璃险|不计免赔";
        final String INSURANCE2 = "|交强险|三者险|乘客险|意外险|车身险|盗抢险|玻璃险|不计免赔";
        final String INSURANCE3 = "|交强险|三者险|乘客险|意外险|车身险|盗抢险|玻璃险|不计免赔";
        final String INSURER_COMPANY = "|中国人保|平安保险|太平洋";
    
        final String title = "车辆保险";
        String today = Helper.dateToString(new Date());
        String now = Helper.datetimeToString(new Date());

        List<AoColum> colums = new ArrayList<AoColum>();
        TableModel model = new TableModel();

        //                           name,             title,         required,     defaut,        cansearch, editable,    edit_type,    edit_data,            editable_settings    
        if(true) {
           colums.add(model.new AoColum("id",    "编号",    false,    "",    false,    false,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("vehicle.plate_number",    "车号",    true,    "",    true,    true,    "select",    Vehicle.getPlate_numberJson(),    null,  "ONEBOX",  "vehicle",  "plate_number",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("driver.name",    "司机",    true,    "",    true,    true,    "select",    Driver.getNameJson(),    null,  "ONEBOX",  "driver",  "name",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("vehicle.brand",    "车型",    true,    "",    true,    false,    "select",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("vehicle.seat_number",    "座位数",    true,    "0",    false,    false,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insurance1",    "保险1",    true,    "",    true,    true,    "select",    Helper.getSelectOptionJson(INSURANCE1),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("premiums1",    "保费1",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured1",    "保额1",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured_date1",    "投保日期1",    true,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insurance2",    "保险2",    false,    "",    true,    true,    "select",    Helper.getSelectOptionJson(INSURANCE2),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("premiums2",    "保费2",    false,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured2",    "保额2",    false,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured_date2",    "投保日期2",    false,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insurance3",    "保险3",    false,    "",    true,    true,    "select",    Helper.getSelectOptionJson(INSURANCE3),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("premiums3",    "保费3",    false,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured3",    "保额3",    false,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured_date3",    "投保日期3",    false,    "",    true,    true,    "date",    null,    null,  "TWOBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insurer_company",    "保险公司",    true,    "",    true,    true,    "selest",    Helper.getSelectOptionJson(INSURER_COMPANY),    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("contact",    "保险公司联系人",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("phone",    "电话",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("mphone",    "手机",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insured",    "投保联系人",    true,    "",    true,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",   "",   "",   "",  false));
        }
        model.buildModel(Insurance.class, 600, title, AuthorHelper.canDo(current_user, title, "增加"), AuthorHelper.canDo(current_user, title, "搜索"), AuthorHelper.canDo(current_user, title, "删除"), colums);
        return model;
    }
}

